core: Attempt direct link() and fallback on EEXIST
authorColin Walters <walters@verbum.org>
Fri, 25 May 2012 00:14:51 +0000 (20:14 -0400)
committerColin Walters <walters@verbum.org>
Fri, 25 May 2012 00:14:51 +0000 (20:14 -0400)
commitfb71519cd6e7c3898601cf31124b9257d8e5f037
tree519f7d59fe2225f366e067ccceea45f272138c4c
parentf7bbf41132cfd29a919e610b0a438c5fb34abc69
core: Attempt direct link() and fallback on EEXIST

Rather than always doing:

1) make temporary link
2) unlink() target
3) rename()

Just try making the link, and only do the second two if the file
already exists.  This reduces system call traffic a lot.
src/libostree/ostree-repo.c